DefaultIfEmpty(TSource) Method (ParallelQuery(TSource))

Task Parallel System.Threading

Returns the elements of the specified parallel sequence or the type parameter's default value in a singleton collection if the sequence is empty.

Namespace:  System.Linq
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Shared Function DefaultIfEmpty(Of TSource) ( _
	source As ParallelQuery(Of TSource) _
) As ParallelQuery(Of TSource)
C#
public static ParallelQuery<TSource> DefaultIfEmpty<TSource>(
	ParallelQuery<TSource> source
)

Parameters

source
Type: System.Linq..::.ParallelQuery<(Of <(TSource>)>)
The sequence to return a default value for if it is empty.

Type Parameters

TSource
The type of the elements of source.

Return Value

A sequence that contains default(TSource) if source is empty; otherwise, source.

Exceptions

ExceptionCondition
System..::.ArgumentNullException source is a null reference (Nothing in Visual Basic).

See Also